﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogisticsBLL;

namespace WebLosgic.TruckTeam
{
    public partial class AddTruckTeam : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            TruckBLL ad = new TruckBLL();
            int results = ad.AddTruckTeam(TexTeamName.Text,TexLeader.Text,TexRemark.Text);
            if (results > 0)
            {
                string name = Session["names"].ToString();
                string Behavor = "" + name + ":添加车队";
                int TypeId = 5;
                int UserID = Convert.ToInt32(Session["UserIDs"]);
                string Parameters = TexTeamName.Text+","+TexLeader.Text+","+TexRemark.Text;
                string ProcName = "p_addteam";
                HttpRequest request = HttpContext.Current.Request;
                string IP = "192.168.0.1";
                int IsExcePion = 0;
                int a = ProcBLL.InserSys(Behavor, TypeId, UserID, Parameters, ProcName, IP, IsExcePion);
                if (a > 0)
                {
                    Page.ClientScript.RegisterStartupScript(GetType(), "eee", "alert('添加成功');location.href='../Chedui.aspx'; ", true);
                }
                
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(GetType(), "eee", "alert('添加失败')", true);
            }
        }

        protected void BtnCong_Click(object sender, EventArgs e)
        {
            TexTeamName.Text = "";
            TexLeader.Text = "";
            TexRemark.Text = "";
        }
    }
}